Skip to content

ReactiveProperty() constructor

Defined in

Type: ReactiveProperty Namespace: ReactiveUI.Reactive Assembly: ReactiveUI.Reactive.dll

Applies to

net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471

Overloads

  • 1. public ReactiveProperty()
  • 2. public ReactiveProperty(T? initialValue)
  • 3. public ReactiveProperty(T? initialValue, bool skipCurrentValueOnSubscribe, bool allowDuplicateValues)
  • 4. public ReactiveProperty(T? initialValue, IScheduler? scheduler, bool skipCurrentValueOnSubscribe, bool allowDuplicateValues)

1. Overload

public ReactiveProperty()

View source

Summary: Initializes a new instance of the ReactiveProperty class with the default value, using the task pool scheduler and default notification and distinctness settings.

Remarks

This constructor is a convenient way to create a ReactiveProperty with commonly used defaults. The property will use the default value for its type, schedule notifications on the task pool scheduler, and will not suppress notifications or enforce distinctness by default.

2. Overload

public ReactiveProperty(T? initialValue)

View source

Summary: Initializes a new instance of the ReactiveProperty class with the specified initial value.

Parameters

NameTypeDescription
initialValueT?The initial value to assign to the property. Can be null for reference types and nullable value types.

3. Overload

public ReactiveProperty(T? initialValue, bool skipCurrentValueOnSubscribe, bool allowDuplicateValues)

View source

Summary: Initializes a new instance of the ReactiveProperty class with the specified initial value, subscription behavior, and duplicate value handling, using the default task pool scheduler.

Parameters

NameTypeDescription
initialValueT?The initial value to assign to the property. Can be null if the type parameter T is a reference type or a nullable value type.
skipCurrentValueOnSubscribebooltrue to prevent subscribers from immediately receiving the current value upon subscription; otherwise, false.
allowDuplicateValuesbooltrue to allow consecutive duplicate values to be published; otherwise, false.

4. Overload

public ReactiveProperty(T? initialValue, IScheduler? scheduler, bool skipCurrentValueOnSubscribe, bool allowDuplicateValues)

View source

Summary: Initializes a new instance of the ReactiveProperty class with the specified initial value, scheduler, and configuration options.

Parameters

NameTypeDescription
initialValueT?The initial value to assign to the property. This value is immediately available to subscribers upon subscription unless skipped by configuration.
scheduler[IScheduler?](#The scheduler used to notify observers of value changes. If null, a default task pool scheduler is used.
skipCurrentValueOnSubscribebooltrue to prevent the current value from being emitted to new subscribers upon subscription; otherwise, false.
allowDuplicateValuesbooltrue to allow consecutive duplicate values to be published to subscribers; otherwise, false to suppress duplicate notifications.

Remarks

Use this constructor to customize the behavior of value emission and notification scheduling for the ReactiveProperty. The configuration options allow control over whether subscribers receive the current value immediately and whether duplicate values are propagated.